﻿using System.Collections.Generic;

namespace MvcForum.Net.Bussiness
{
    public class ModerateRepo
    {
        public static  List<Moderator> List()
        {
            return MainDB.Instant.Moderator_List().ExecuteTypedList<Moderator>();

        }

        public static  List<Moderator> List(string username)
        {
            return MainDB.Instant.Moderator_ListByUserName(username).ExecuteTypedList<Moderator>();   
        }

        public static void Save(int userId,string username,int forumId,string accessmask)
        {
            MainDB.Instant.Moderator_Save(userId, username,forumId,accessmask).Execute();
        }


        public static Moderator Info(int id)
        {
            var _data = MainDB.Instant.Moderator_Detail(id).ExecuteTypedList<Moderator>();

            return _data.Count > 0 ? _data[0] : null;
        }

        public static void Del(string ids)
        {
            MainDB.Instant.Moderator_Delete(ids).Execute();
        }

    }
}